package com.pg.free.actor.menu;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.pg.free.util.Const;
import com.pg.free.util.Context;
import com.pg.free.util.Logger;
import com.pg.laboratory.screen.AnimationScreen;

public class Start extends Actor {

	private Texture start;
	private ClickListener cl;

	public Start() {

		start = new Texture(Gdx.files.internal("image/start.png"));
		this.setWidth(start.getWidth());
		this.setHeight(start.getHeight());
		this.setX(Const.viewWidth / 2 - this.getWidth() / 2);
		this.setY(Const.viewHeight / 2 + this.getHeight());
		cl = new ClickListener() {

			@Override
			public void clicked(InputEvent event, float x, float y) {
				Context.game.setCurrentScreen(new AnimationScreen());
			}

		};
		this.addListener(cl);
	}

	@Override
	public void draw(SpriteBatch batch, float parentAlpha) {
		batch.draw(start, getX(), getY());
	}

	public void dispose() {
		start.dispose();
		Logger.debug("start", "dispose");
	}
}
